﻿//Copyright (C) <2013>  <jonathan cleeve norton> All Rights Reserved 
//Contact jon.norton@fin-plus.co.uk website <http://www.fin-plus.co.uk/>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Xml;

namespace FinPlusInterfaces
{
    public interface IPods : IDictionary<int, IPod>, ICollection<KeyValuePair<int, IPod>>, IEnumerable<KeyValuePair<int, IPod>>
    {
        string Id { get; set; }
        EventHandler<BeanEventArgs> PodUpdate { get; set; }

        IPods Clone();

        void Refresh();
       
        IPod Add(IPod value, bool nextId = true, bool setId = true);

        void Get<T>(string name, T defaultValue, PropertyChangedEventHandler changeEventHander = null);

        void Set<T>(string name, string value, T defaultValue);

        void Update(IPod value, ChangeType changeType);

        void Remove(string expression);

        bool TryRemove(int id, out IPod value);

        bool TryAdd(int id, IPod value);

        IPod Get(string id);

        IPod First(string expression);

        IDictionary<string, IPod> Where(string expression, string key = "Id");

        XmlDocument ToXmlDoc(string nodes = "root/current");

        string ToString();

        IPod[] ToArray(string name, string match);

        IList<IPod> ToList(string name, string match, char delimitor ='\0');

        IList<string> ToList(string name);

        IDictionary<string, string> ToDictionary(string key, string value);

        int NextKey();

        void FromXml(string xmlPathOrString, string xmlNodes, string replaceValue);

        void AddXml(ref int id, XmlElement xml, IDictionary<string, string> replace);

        XmlDocument ToXml(string nodes);
    }
}
